package com.tuyou.demo2;

import com.tuyou.demo2.swift.HelloService;
import com.tuyou.demo2.swift.MyException;

import java.util.Random;

public class HelloServiceImpl implements HelloService {
    public String ping() throws MyException {

        boolean flag =new Random().nextBoolean();
        if (flag) {
            String str = "happen a exception";
            System.out.println(str);
            throw new MyException(str);
        }

        return "hello service impl";
    }
}
